package com.company.jncz.web.actions;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class HelloController {
	private BasicDataSource datasource;
	@Autowired
	public void setDataSource(BasicDataSource bds){
		this.datasource = bds;
	}
	@RequestMapping(value="/hello",method=RequestMethod.GET)
	public ModelAndView handleRequest(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		request.setAttribute("testkey", "testvalue");
		System.out.println(this.datasource);
		return new ModelAndView("hello");
	}

}
